<?php
abstract class Ifilter {
	
	protected $keyTranslateMap;
	protected $valueTranslateMap;
	
	
	protected abstract function translate($key,$value);
	
	public function extract($data) {
		$result_arr = array();
		foreach ($data as $entities) {
			$arr = array();
			foreach ($entities as $key=>$value) {
				if (array_key_exists($key, $this->keyTranslateMap)) {
					$value_translated = $this->translate($key,$value);
					$key_translated = $this->keyTranslateMap[$key];
				    $arr[$key_translated] = $value_translated;
				}
			}
			if (!empty($arr)) {
				$result_arr[] = $arr;
			}
		}
		return $result_arr;
	}
}